import {
    $request
} from '../../utils/request'


// 获取帖子信息
export const getOtherHome = ((id) => {
    return new Promise((resolve, reject) => {
        $request({
            url:'otherhome/' + id + '/',
            method:'GET'
        }).then((response) => {
            console.log("获取他人主页信息成功", response);
            resolve(response.data)
        }).catch((error) => {
            console.log("获取他人主页信息失败", error);
            reject(error)
        })
    })
})


// 获取关注信息

export const getAttentions = ((id) => {
    return new Promise ((resolve, reject) => {
        $request({
            url:'getattention?id=' + id,
            method:'GET',
        }).then((response) => {
            console.log("获取关注信息成功", response);
            resolve(response.data)
        }).catch((error) => {
            console.log("获取关注信息失败", error);
            reject(error)
        })
    })
})


// 关注
export const getFollow = ((id, method) => {
    return new Promise ((resolve, reject) => {
        $request({
            url:'follow',
            method:String(method),
            data:{
                follower:id
            }
        }).then((response) => {
            console.log("关注成功", response);
            resolve(response.data)
        }).catch((error) => {
            console.log("关注失败", error);
            reject(error)
        })
    })
})